home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / gdb.info-4 < prev    next >
Encoding:
Text File  |  1992-04-11  |  49.5 KB  |  1,390 lines

  1. Info file ./gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb: (gdb).                   The GNU debugger.
  6. END-INFO-DIR-ENTRY
  7.    This file documents the GNU debugger GDB.
  8.  
  9.    This is Edition 4.04, March 1992, of `Using GDB: A Guide to the GNU
  10. Source-Level Debugger' for GDB Version 4.5.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software
  13. Foundation, Inc.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of
  16. this manual provided the copyright notice and this permission notice
  17. are preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided also
  21. that the section entitled "GNU General Public License" is included
  22. exactly as in the original, and provided that the entire resulting
  23. derived work is distributed under the terms of a permission notice
  24. identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that the section entitled "GNU General Public
  29. License" may be included in a translation approved by the Free
  30. Software Foundation instead of in the original English.
  31.  
  32. 
  33. File: gdb.info,  Node: Manually,  Next: Automatically,  Prev: Setting,  Up: Setting
  34.  
  35. Setting the working language
  36. ----------------------------
  37.  
  38.    To set the language, issue the command `set language LANG', where
  39. LANG is the name of a language: `c' or `modula-2'.  For a list of the
  40. supported languages, type `set language'.
  41.  
  42.    Setting the language manually prevents GDB from updating the working
  43. language automatically.  This can lead to confusion if you try to
  44. debug a program when the working language is not the same as the
  45. source language, when an expression is acceptable to both
  46. languages--but means different things.  For instance, if the current
  47. source file were written in C, and GDB was parsing Modula-2, a command
  48. such as:
  49.  
  50.      print a = b + c
  51.  
  52. might not have the effect you intended.  In C, this means to add `b'
  53. and `c' and place the result in `a'.  The result printed would be the
  54. value of `a'.  In Modula-2, this means to compare `a' to the result of
  55. `b+c', yielding a `BOOLEAN' value.
  56.  
  57.    If you allow GDB to set the language automatically, then you can
  58. count on expressions evaluating the same way in your debugging session
  59. and in your program.
  60.  
  61. 
  62. File: gdb.info,  Node: Automatically,  Prev: Manually,  Up: Setting
  63.  
  64. Having GDB infer the source language
  65. ------------------------------------
  66.  
  67.    To have GDB set the working language automatically, use `set
  68. language local' or `set language auto'.  GDB then infers the language
  69. that a program was written in by looking at the name of its source
  70. files, and examining their extensions:
  71.  
  72. `*.mod'
  73.      Modula-2 source file
  74.  
  75. `*.c'
  76. `*.cc'
  77.      C or C++ source file.
  78.  
  79.    This information is recorded for each function or procedure in a
  80. source file.  When your program stops in a frame (usually by
  81. encountering a breakpoint), GDB sets the working language to the
  82. language recorded for the function in that frame.  If the language for
  83. a frame is unknown (that is, if the function or block corresponding to
  84. the frame was defined in a source file that does not have a recognized
  85. extension), the current working language is not changed, and GDB
  86. issues a warning.
  87.  
  88.    This may not seem necessary for most programs, which are written
  89. entirely in one source language.  However, program modules and
  90. libraries written in one source language can be used by a main program
  91. written in a different source language.  Using `set language auto' in
  92. this case frees you from having to set the working language manually.
  93.  
  94. 
  95. File: gdb.info,  Node: Show,  Next: Checks,  Prev: Setting,  Up: Languages
  96.  
  97. Displaying the language
  98. =======================
  99.  
  100.    The following commands will help you find out which language is the
  101. working language, and also what language source files were written in.
  102.  
  103. `show language'
  104.      Display the current working language.  This is the language you
  105.      can use with commands such as `print' to build and compute
  106.      expressions that may involve variables in your program.
  107.  
  108. `info frame'
  109.      Among the other information listed here (*note Information about
  110.      a Frame: Frame Info.) is the source language for this frame. 
  111.      This is the language that will become the working language if you
  112.      ever use an identifier that is in this frame.
  113.  
  114. `info source'
  115.      Among the other information listed here (*note Examining the
  116.      Symbol Table: Symbols.) is the source language of this source
  117.      file.
  118.  
  119. 
  120. File: gdb.info,  Node: Checks,  Next: Support,  Prev: Show,  Up: Languages
  121.  
  122. Type and range Checking
  123. =======================
  124.  
  125.      *Warning:* In this release, the GDB commands for type and range
  126.      checking are included, but they do not yet have any effect.  This
  127.      section documents the intended facilities.
  128.  
  129.    Some languages are designed to guard you against making seemingly
  130. common errors through a series of compile- and run-time checks.  These
  131. include checking the type of arguments to functions and operators, and
  132. making sure mathematical overflows are caught at run time.  Checks
  133. such as these help to ensure a program's correctness once it has been
  134. compiled by eliminating type mismatches, and providing active checks
  135. for range errors when your program is running.
  136.  
  137.    GDB can check for conditions like the above if you wish.  Although
  138. GDB will not check the statements in your program, it can check
  139. expressions entered directly into GDB for evaluation via the `print'
  140. command, for example.  As with the working language, GDB can also
  141. decide whether or not to check automatically based on your program's
  142. source language.  *Note Supported Languages: Support, for the default
  143. settings of supported languages.
  144.  
  145. * Menu:
  146.  
  147. * Type Checking::               An overview of type checking
  148. * Range Checking::              An overview of range checking
  149.  
  150. 
  151. File: gdb.info,  Node: Type Checking,  Next: Range Checking,  Prev: Checks,  Up: Checks
  152.  
  153. An overview of type checking
  154. ----------------------------
  155.  
  156.    Some languages, such as Modula-2, are strongly typed, meaning that
  157. the arguments to operators and functions have to be of the correct
  158. type, otherwise an error occurs.  These checks prevent type mismatch
  159. errors from ever causing any run-time problems.  For example,
  160.  
  161.      1 + 2 => 3
  162. but
  163.      error--> 1 + 2.3
  164.  
  165.    The second example fails because the `CARDINAL' 1 is not
  166. type-compatible with the `REAL' 2.3.
  167.  
  168.    For expressions you use in GDB commands, you can tell the GDB type
  169. checker to skip checking; to treat any mismatches as errors and
  170. abandon the expression; or only issue warnings when type mismatches
  171. occur, but evaluate the expression anyway.  When you choose the last of
  172. these, GDB evaluates expressions like the second example above, but
  173. also issues a warning.
  174.  
  175.    Even though you may turn type checking off, other type-based
  176. reasons may prevent GDB from evaluating an expression.  For instance,
  177. GDB does not know how to add an `int' and a `struct foo'.  These
  178. particular type errors have nothing to do with the language in use,
  179. and usually arise from expressions, such as the one described above,
  180. which make little sense to evaluate anyway.
  181.  
  182.    Each language defines to what degree it is strict about type.  For
  183. instance, both Modula-2 and C require the arguments to arithmetical
  184. operators to be numbers.  In C, enumerated types and pointers can be
  185. represented as numbers, so that they are valid arguments to
  186. mathematical operators.  *Note Supported Languages: Support, for
  187. further details on specific languages.
  188.  
  189.    GDB provides some additional commands for controlling the type
  190. checker:
  191.  
  192. `set check type auto'
  193.      Set type checking on or off based on the current working language. 
  194.      *Note Supported Languages: Support, for the default settings for
  195.      each language.
  196.  
  197. `set check type on'
  198. `set check type off'
  199.      Set type checking on or off, overriding the default setting for
  200.      the current working language.  Issue a warning if the setting
  201.      does not match the language's default.  If any type mismatches
  202.      occur in evaluating an expression while typechecking is on, GDB
  203.      prints a message and aborts evaluation of the expression.
  204.  
  205. `set check type warn'
  206.      Cause the type checker to issue warnings, but to always attempt to
  207.      evaluate the expression.  Evaluating the expression may still be
  208.      impossible for other reasons.  For example, GDB cannot add
  209.      numbers and structures.
  210.  
  211. `show type'
  212.      Show the current setting of the type checker, and whether or not
  213.      GDB is setting it automatically.
  214.  
  215. 
  216. File: gdb.info,  Node: Range Checking,  Prev: Type Checking,  Up: Checks
  217.  
  218. An overview of Range Checking
  219. -----------------------------
  220.  
  221.    In some languages (such as Modula-2), it is an error to exceed the
  222. bounds of a type; this is enforced with run-time checks.  Such range
  223. checking is meant to ensure program correctness by making sure
  224. computations do not overflow, or indices on an array element access do
  225. not exceed the bounds of the array.
  226.  
  227.    For expressions you use in GDB commands, you can tell GDB to ignore
  228. range errors; to always treat them as errors and abandon the
  229. expression; or to issue warnings when a range error occurs but evaluate
  230. the expression anyway.
  231.  
  232.    A range error can result from numerical overflow, from exceeding an
  233. array index bound, or when you type in a constant that is not a member
  234. of any type.  Some languages, however, do not treat overflows as an
  235. error.  In many implementations of C, mathematical overflow causes the
  236. result to "wrap around" to lower values--for example, if M is the
  237. largest integer value, and S is the smallest, then
  238.  
  239.      M + 1 => S
  240.  
  241.    This, too, is specific to individual languages, and in some cases
  242. specific to individual compilers or machines.  *Note  Supported
  243. Languages: Support, for further details on specific languages.
  244.  
  245.    GDB provides some additional commands for controlling the range
  246. checker:
  247.  
  248. `set check range auto'
  249.      Set range checking on or off based on the current working
  250.      language.  *Note Supported Languages: Support, for the default
  251.      settings for each language.
  252.  
  253. `set check range on'
  254. `set check range off'
  255.      Set range checking on or off, overriding the default setting for
  256.      the current working language.  A warning is issued if the setting
  257.      does not match the language's default.  If a range error occurs,
  258.      then a message is printed and evaluation of the expression is
  259.      aborted.
  260.  
  261. `set check range warn'
  262.      Output messages when the GDB range checker detects a range error,
  263.      but attempt to evaluate the expression anyway.  Evaluating the
  264.      expression may still be impossible for other reasons, such as
  265.      accessing memory that the process does not own (a typical example
  266.      from many UNIX systems).
  267.  
  268. `show range'
  269.      Show the current setting of the range checker, and whether or not
  270.      it is being set automatically by GDB.
  271.  
  272. 
  273. File: gdb.info,  Node: Support,  Prev: Checks,  Up: Languages
  274.  
  275. Supported Languages
  276. ===================
  277.  
  278.    GDB 4 supports C, C++, and Modula-2.  The syntax for C and C++ is so
  279. closely related that GDB does not distinguish the two.  Some GDB
  280. features may be used in expressions regardless of the language you
  281. use: the GDB `@' and `::' operators, and the `{type}addr' construct
  282. (*note Expressions: Expressions.) can be used with the constructs of
  283. any of the supported languages.
  284.  
  285.    The following sections detail to what degree each of these source
  286. languages is supported by GDB.  These sections are not meant to be
  287. language tutorials or references, but serve only as a reference guide
  288. to what the GDB expression parser will accept, and what input and
  289. output formats should look like for different languages.  There are
  290. many good books written on each of these languages; please look to
  291. these for a language reference or tutorial.
  292.  
  293. * Menu:
  294.  
  295. * C::                           C and C++
  296. * Modula-2::                    Modula-2
  297.  
  298. 
  299. File: gdb.info,  Node: C,  Next: Modula-2,  Prev: Support,  Up: Support
  300.  
  301. C and C++
  302. ---------
  303.  
  304.    Since C and C++ are so closely related, GDB does not distinguish
  305. between them when interpreting the expressions recognized in GDB
  306. commands.
  307.  
  308.    The C++ debugging facilities are jointly implemented by the GNU C++
  309. compiler and GDB.  Therefore, to debug your C++ code effectively, you
  310. must compile your C++ programs with the GNU C++ compiler, `g++'.
  311.  
  312. * Menu:
  313.  
  314. * C Operators::                 C and C++ Operators
  315. * C Constants::                 C and C++ Constants
  316. * Cplusplus expressions::       C++ Expressions
  317. * C Defaults::                  Default settings for C and C++
  318. * C Checks::                    C and C++ Type and Range Checks
  319. * Debugging C::                 GDB and C
  320. * Debugging C plus plus::       Special features for C++
  321.  
  322. 
  323. File: gdb.info,  Node: C Operators,  Next: C Constants,  Prev: C,  Up: C
  324.  
  325. C and C++ Operators
  326. ...................
  327.  
  328.    Operators must be defined on values of specific types.  For
  329. instance, `+' is defined on numbers, but not on structures.  Operators
  330. are often defined on groups of types.  For the purposes of C and C++,
  331. the following definitions hold:
  332.  
  333.    * *Integral types* include `int' with any of its storage-class
  334.      specifiers, `char', and `enum's.
  335.  
  336.    * *Floating-point types* include `float' and `double'.
  337.  
  338.    * *Pointer types* include all types defined as `(TYPE *)'.
  339.  
  340.    * *Scalar types* include all of the above.
  341.  
  342. The following operators are supported.  They are listed here in order
  343. of increasing precedence:
  344.  
  345. `,'
  346.      The comma or sequencing operator.  Expressions in a
  347.      comma-separated list are evaluated from left to right, with the
  348.      result of the entire expression being the last expression
  349.      evaluated.
  350.  
  351. `='
  352.      Assignment.  The value of an assignment expression is the value
  353.      assigned.  Defined on scalar types.
  354.  
  355. `OP='
  356.      Used in an expression of the form `A OP= B', and translated to
  357.      `A = A OP B'.  `OP=' and `=' have the same precendence.  OP is
  358.      any one of the operators `|', `^', `&', `<<', `>>', `+', `-',
  359.      `*', `/', `%'.
  360.  
  361. `?:'
  362.      The ternary operator.  `A ? B : C' can be thought of as:  if A
  363.      then B else C.  A should be of an integral type.
  364.  
  365. `||'
  366.      Logical OR.  Defined on integral types.
  367.  
  368. `&&'
  369.      Logical AND.  Defined on integral types.
  370.  
  371. `|'
  372.      Bitwise OR.  Defined on integral types.
  373.  
  374. `^'
  375.      Bitwise exclusive-OR.  Defined on integral types.
  376.  
  377. `&'
  378.      Bitwise AND.  Defined on integral types.
  379.  
  380. `==, !='
  381.      Equality and inequality.  Defined on scalar types.  The value of
  382.      these expressions is 0 for false and non-zero for true.
  383.  
  384. `<, >, <=, >='
  385.      Less than, greater than, less than or equal, greater than or
  386.      equal.  Defined on scalar types.  The value of these expressions
  387.      is 0 for false and non-zero for true.
  388.  
  389. `<<, >>'
  390.      left shift, and right shift.  Defined on integral types.
  391.  
  392. `@'
  393.      The GDB "artificial array" operator (*note Expressions:
  394.      Expressions.).
  395.  
  396. `+, -'
  397.      Addition and subtraction.  Defined on integral types,
  398.      floating-point types and pointer types.
  399.  
  400. `*, /, %'
  401.      Multiplication, division, and modulus.  Multiplication and
  402.      division are defined on integral and floating-point types. 
  403.      Modulus is defined on integral types.
  404.  
  405. `++, --'
  406.      Increment and decrement.  When appearing before a variable, the
  407.      operation is performed before the variable is used in an
  408.      expression; when appearing after it, the variable's value is used
  409.      before the operation takes place.
  410.  
  411. `*'
  412.      Pointer dereferencing.  Defined on pointer types.  Same
  413.      precedence as `++'.
  414.  
  415. `&'
  416.      Address operator.  Defined on variables.  Same precedence as `++'.
  417.  
  418.      For debugging C++, GDB implements a use of `&' beyond what's
  419.      allowed in the C++ language itself: you can use `&(&REF)' (or, if
  420.      you prefer, simply `&&REF' to examine the address where a C++
  421.      reference variable (declared with `&REF') is stored.
  422.  
  423. `-'
  424.      Negative.  Defined on integral and floating-point types.  Same
  425.      precedence as `++'.
  426.  
  427. `!'
  428.      Logical negation.  Defined on integral types.  Same precedence as
  429.      `++'.
  430.  
  431. `~'
  432.      Bitwise complement operator.  Defined on integral types.  Same
  433.      precedence as `++'.
  434.  
  435. `., ->'
  436.      Structure member, and pointer-to-structure member.  For
  437.      convenience, GDB regards the two as equivalent, choosing whether
  438.      to dereference a pointer based on the stored type information. 
  439.      Defined on `struct's and `union's.
  440.  
  441. `[]'
  442.      Array indexing.  `A[I]' is defined as `*(A+I)'.  Same precedence
  443.      as `->'.
  444.  
  445. `()'
  446.      Function parameter list.  Same precedence as `->'.
  447.  
  448. `::'
  449.      C++ scope resolution operator.  Defined on `struct', `union', and
  450.      `class' types.
  451.  
  452. `::'
  453.      The GDB scope operator (*note Expressions: Expressions.).  Same
  454.      precedence as `::', above.
  455.  
  456. 
  457. File: gdb.info,  Node: C Constants,  Next: Cplusplus expressions,  Prev: C Operators,  Up: C
  458.  
  459. C and C++ Constants
  460. ...................
  461.  
  462.    GDB allows you to express the constants of C and C++ in the
  463. following ways:
  464.  
  465.    * Integer constants are a sequence of digits.  Octal constants are
  466.      specified by a leading `0' (ie. zero), and hexadecimal constants
  467.      by a leading `0x' or `0X'.  Constants may also end with a letter
  468.      `l', specifying that the constant should be treated as a `long'
  469.      value.
  470.  
  471.    * Floating point constants are a sequence of digits, followed by a
  472.      decimal point, followed by a sequence of digits, and optionally
  473.      followed by an exponent.  An exponent is of the form:
  474.      `e[[+]|-]NNN', where NNN is another sequence of digits.  The `+'
  475.      is optional for positive exponents.
  476.  
  477.    * Enumerated constants consist of enumerated identifiers, or their
  478.      integral equivalents.
  479.  
  480.    * Character constants are a single character surrounded by single
  481.      quotes (`''), or a number--the ordinal value of the corresponding
  482.      character (usually its ASCII value).  Within quotes, the single
  483.      character may be represented by a letter or by "escape
  484.      sequences", which are of the form `\NNN', where NNN is the octal
  485.      representation of the character's ordinal value; or of the form
  486.      `\X', where `X' is a predefined special character--for example,
  487.      `\n' for newline.
  488.  
  489.    * String constants are a sequence of character constants surrounded
  490.      by double quotes (`"').
  491.  
  492.    * Pointer constants are an integral value.
  493.  
  494. 
  495. File: gdb.info,  Node: Cplusplus expressions,  Next: C Defaults,  Prev: C Constants,  Up: C
  496.  
  497. C++ Expressions
  498. ...............
  499.  
  500.    GDB's expression handling has the following extensions to interpret
  501. a significant subset of C++ expressions:
  502.  
  503.   1. Member function calls are allowed; you can use expressions like
  504.  
  505.           count = aml->GetOriginal(x, y)
  506.  
  507.   2. While a member function is active (in the selected stack frame),
  508.      your expressions have the same namespace available as the member
  509.      function; that is, GDB allows implicit references to the class
  510.      instance pointer `this' following the same rules as C++.
  511.  
  512.   3. You can call overloaded functions; GDB will resolve the function
  513.      call to the right definition, with one restriction--you must use
  514.      arguments of the type required by the function that you want to
  515.      call.  GDB will not perform conversions requiring constructors or
  516.      user-defined type operators.
  517.  
  518.   4. GDB understands variables declared as C++ references; you can use
  519.      them in expressions just as you do in C++ source--they are
  520.      automatically dereferenced.
  521.  
  522.         In the parameter list shown when GDB displays a frame, the
  523.      values of reference variables are not displayed (unlike other
  524.      variables); this avoids clutter, since references are often used
  525.      for large structures.  The *address* of a reference variable is
  526.      always shown, unless you have specified `set print address off'.
  527.  
  528.   5. GDB supports the C++ name resolution operator `::'--your
  529.      expressions can use it just as expressions in your program do. 
  530.      Since one scope may be defined in another, you can use `::'
  531.      repeatedly if necessary, for example in an expression like
  532.      `SCOPE1::SCOPE2::NAME'.  GDB also allows resolving name scope by
  533.      reference to source files, in both C and C++ debugging (*note
  534.      Program Variables: Variables.).
  535.  
  536. 
  537. File: gdb.info,  Node: C Defaults,  Next: C Checks,  Prev: Cplusplus expressions,  Up: C
  538.  
  539. C and C++ Defaults
  540. ..................
  541.  
  542.    If you allow GDB to set type and range checking automatically, they
  543. both default to `off' whenever the working language changes to C/C++. 
  544. This happens regardless of whether you, or GDB, selected the working
  545. language.
  546.  
  547.    If you allow GDB to set the language automatically, it sets the
  548. working language to C/C++ on entering code compiled from a source file
  549. whose name ends with `.c' or `.cc'.  *Note Having GDB infer the source
  550. language: Automatically, for further details.
  551.  
  552. 
  553. File: gdb.info,  Node: C Checks,  Next: Debugging C,  Prev: C Defaults,  Up: C
  554.  
  555. C and C++ Type and Range Checks
  556. ...............................
  557.  
  558.      *Warning:* in this release, GDB does not yet perform type or
  559.      range checking.
  560.  
  561.    By default, when GDB parses C or C++ expressions, type checking is
  562. not used.  However, if you turn type checking on, GDB will consider
  563. two variables type equivalent if:
  564.  
  565.    * The two variables are structured and have the same structure,
  566.      union, or enumerated tag.
  567.  
  568.    * Two two variables have the same type name, or types that have been
  569.      declared equivalent through `typedef'.
  570.  
  571.    Range checking, if turned on, is done on mathematical operations. 
  572. Array indices are not checked, since they are often used to index a
  573. pointer that is not itself an array.
  574.  
  575. 
  576. File: gdb.info,  Node: Debugging C,  Next: Debugging C plus plus,  Prev: C Checks,  Up: C
  577.  
  578. GDB and C
  579. .........
  580.  
  581.    The `set print union' and `show print union' commands apply to the
  582. `union' type.  When set to `on', any `union' that is inside a `struct'
  583. or `class' will also be printed.  Otherwise, it will appear as `{...}'.
  584.  
  585.    The `@' operator aids in the debugging of dynamic arrays, formed
  586. with pointers and a memory allocation function.  (*note Expressions:
  587. Expressions.)
  588.  
  589. 
  590. File: gdb.info,  Node: Debugging C plus plus,  Prev: Debugging C,  Up: C
  591.  
  592. GDB Commands for C++
  593. ....................
  594.  
  595.    Some GDB commands are particularly useful with C++, and some are
  596. designed specifically for use with C++.  Here is a summary:
  597.  
  598. `breakpoint menus'
  599.      When you want a breakpoint in a function whose name is overloaded,
  600.      GDB's breakpoint menus help you specify which function definition
  601.      you want.  *Note Breakpoint Menus::.
  602.  
  603. `rbreak REGEX'
  604.      Setting breakpoints using regular expressions is helpful for
  605.      setting breakpoints on overloaded functions that are not members
  606.      of any special classes.  *Note Setting Breakpoints: Set Breaks.
  607.  
  608. `catch EXCEPTIONS'
  609. `info catch'
  610.      Debug C++ exception handling using these commands.  *Note
  611.      Breakpoints and Exceptions: Exception Handling.
  612.  
  613. `ptype TYPENAME'
  614.      Print inheritance relationships as well as other information for
  615.      type TYPENAME.  *Note Examining the Symbol Table: Symbols.
  616.  
  617. `set print demangle'
  618. `show print demangle'
  619. `set print asm-demangle'
  620. `show print asm-demangle'
  621.      Control whether C++ symbols display in their source form, both
  622.      when displaying code as C++ source and when displaying
  623.      disassemblies.  *Note Print Settings: Print Settings.
  624.  
  625. `set print object'
  626. `show print object'
  627.      Choose whether to print derived (actual) or declared types of
  628.      objects.  *Note Print Settings: Print Settings.
  629.  
  630. `set print vtbl'
  631. `show print vtbl'
  632.      Control the format for printing virtual function tables.  *Note
  633.      Print Settings: Print Settings.
  634.  
  635. 
  636. File: gdb.info,  Node: Modula-2,  Prev: C,  Up: Support
  637.  
  638. Modula-2
  639. --------
  640.  
  641.    The extensions made to GDB to support Modula-2 support output from
  642. the GNU Modula-2 compiler (which is currently being developed).  Other
  643. Modula-2 compilers are not currently supported, and attempting to
  644. debug executables produced by them will most likely result in an error
  645. as GDB reads in the executable's symbol table.
  646.  
  647. * Menu:
  648.  
  649. * M2 Operators::                Built-in operators
  650. * Built-In Func/Proc::           Built-in Functions and Procedures
  651. * M2 Constants::                Modula-2 Constants
  652. * M2 Defaults::                 Default settings for Modula-2
  653. * Deviations::                  Deviations from standard Modula-2
  654. * M2 Checks::                   Modula-2 Type and Range Checks
  655. * M2 Scope::                    The scope operators `::' and `.'
  656. * GDB/M2::                      GDB and Modula-2
  657.  
  658. 
  659. File: gdb.info,  Node: M2 Operators,  Next: Built-In Func/Proc,  Prev: Modula-2,  Up: Modula-2
  660.  
  661. Operators
  662. .........
  663.  
  664.    Operators must be defined on values of specific types.  For
  665. instance, `+' is defined on numbers, but not on structures.  Operators
  666. are often defined on groups of types.  For the purposes of Modula-2,
  667. the following definitions hold:
  668.  
  669.    * *Integral types* consist of `INTEGER', `CARDINAL', and their
  670.      subranges.
  671.  
  672.    * *Character types* consist of `CHAR' and its subranges.
  673.  
  674.    * *Floating-point types* consist of `REAL'.
  675.  
  676.    * *Pointer types* consist of anything declared as `POINTER TO TYPE'.
  677.  
  678.    * *Scalar types* consist of all of the above.
  679.  
  680.    * *Set types* consist of `SET's and `BITSET's.
  681.  
  682.    * *Boolean types* consist of `BOOLEAN'.
  683.  
  684. The following operators are supported, and appear in order of
  685. increasing precedence:
  686.  
  687. `,'
  688.      Function argument or array index separator.
  689.  
  690. `:='
  691.      Assignment.  The value of VAR `:=' VALUE is VALUE.
  692.  
  693. `<, >'
  694.      Less than, greater than on integral, floating-point, or enumerated
  695.      types.
  696.  
  697. `<=, >='
  698.      Less than, greater than, less than or equal to, greater than or
  699.      equal to on integral, floating-point and enumerated types, or set
  700.      inclusion on set types.  Same precedence as `<'.
  701.  
  702. `=, <>, #'
  703.      Equality and two ways of expressing inequality, valid on scalar
  704.      types.  Same precedence as `<'.  In GDB scripts, only `<>' is
  705.      available for inequality, since `#' conflicts with the script
  706.      comment character.
  707.  
  708. `IN'
  709.      Set membership.  Defined on set types and the types of their
  710.      members.  Same precedence as `<'.
  711.  
  712. `OR'
  713.      Boolean disjunction.  Defined on boolean types.
  714.  
  715. `AND, &'
  716.      Boolean conjuction.  Defined on boolean types.
  717.  
  718. `@'
  719.      The GDB "artificial array" operator (*note Expressions:
  720.      Expressions.).
  721.  
  722. `+, -'
  723.      Addition and subtraction on integral and floating-point types, or
  724.      union and difference on set types.
  725.  
  726. `*'
  727.      Multiplication on integral and floating-point types, or set
  728.      intersection on set types.
  729.  
  730. `/'
  731.      Division on floating-point types, or symmetric set difference on
  732.      set types.  Same precedence as `*'.
  733.  
  734. `DIV, MOD'
  735.      Integer division and remainder.  Defined on integral types.  Same
  736.      precedence as `*'.
  737.  
  738. `-'
  739.      Negative. Defined on `INTEGER's and `REAL's.
  740.  
  741. `^'
  742.      Pointer dereferencing.  Defined on pointer types.
  743.  
  744. `NOT'
  745.      Boolean negation.  Defined on boolean types.  Same precedence as
  746.      `^'.
  747.  
  748. `.'
  749.      `RECORD' field selector.  Defined on `RECORD's.  Same precedence
  750.      as `^'.
  751.  
  752. `[]'
  753.      Array indexing.  Defined on `ARRAY's.  Same precedence as `^'.
  754.  
  755. `()'
  756.      Procedure argument list.  Defined on `PROCEDURE's.  Same
  757.      precedence as `^'.
  758.  
  759. `::, .'
  760.      GDB and Modula-2 scope operators.
  761.  
  762.      *Warning:* Sets and their operations are not yet supported, so GDB
  763.      will treat the use of the operator `IN', or the use of operators
  764.      `+', `-', `*', `/', `=', , `<>', `#', `<=', and `>=' on sets as
  765.      an error.
  766.  
  767. 
  768. File: gdb.info,  Node: Built-In Func/Proc,  Next: M2 Constants,  Prev: M2 Operators,  Up: Modula-2
  769.  
  770. Built-in Functions and Procedures
  771. .................................
  772.  
  773.    Modula-2 also makes available several built-in procedures and
  774. functions.  In describing these, the following metavariables are used:
  775.  
  776. A
  777.      represents an `ARRAY' variable.
  778.  
  779. C
  780.      represents a `CHAR' constant or variable.
  781.  
  782. I
  783.      represents a variable or constant of integral type.
  784.  
  785. M
  786.      represents an identifier that belongs to a set.  Generally used
  787.      in the same function with the metavariable S.  The type of S
  788.      should be `SET OF MTYPE' (where MTYPE is the type of M.
  789.  
  790. N
  791.      represents a variable or constant of integral or floating-point
  792.      type.
  793.  
  794. R
  795.      represents a variable or constant of floating-point type.
  796.  
  797. T
  798.      represents a type.
  799.  
  800. V
  801.      represents a variable.
  802.  
  803. X
  804.      represents a variable or constant of one of many types.  See the
  805.      explanation of the function for details.
  806.  
  807.    All Modula-2 built-in procedures also return a result, described
  808. below.
  809.  
  810. `ABS(N)'
  811.      Returns the absolute value of N.
  812.  
  813. `CAP(C)'
  814.      If C is a lower case letter, it returns its upper case
  815.      equivalent, otherwise it returns its argument
  816.  
  817. `CHR(I)'
  818.      Returns the character whose ordinal value is I.
  819.  
  820. `DEC(V)'
  821.      Decrements the value in the variable V.  Returns the new value.
  822.  
  823. `DEC(V,I)'
  824.      Decrements the value in the variable V by I.  Returns the new
  825.      value.
  826.  
  827. `EXCL(M,S)'
  828.      Removes the element M from the set S.  Returns the new set.
  829.  
  830. `FLOAT(I)'
  831.      Returns the floating point equivalent of the integer I.
  832.  
  833. `HIGH(A)'
  834.      Returns the index of the last member of A.
  835.  
  836. `INC(V)'
  837.      Increments the value in the variable V.  Returns the new value.
  838.  
  839. `INC(V,I)'
  840.      Increments the value in the variable V by I.  Returns the new
  841.      value.
  842.  
  843. `INCL(M,S)'
  844.      Adds the element M to the set S if it is not already there. 
  845.      Returns the new set.
  846.  
  847. `MAX(T)'
  848.      Returns the maximum value of the type T.
  849.  
  850. `MIN(T)'
  851.      Returns the minimum value of the type T.
  852.  
  853. `ODD(I)'
  854.      Returns boolean TRUE if I is an odd number.
  855.  
  856. `ORD(X)'
  857.      Returns the ordinal value of its argument.  For example, the
  858.      ordinal value of a character is its ASCII value (on machines
  859.      supporting the ASCII character set).  X must be of an ordered
  860.      type, which include integral, character and enumerated types.
  861.  
  862. `SIZE(X)'
  863.      Returns the size of its argument.  X can be a variable or a type.
  864.  
  865. `TRUNC(R)'
  866.      Returns the integral part of R.
  867.  
  868. `VAL(T,I)'
  869.      Returns the member of the type T whose ordinal value is I.
  870.  
  871.      *Warning:*  Sets and their operations are not yet supported, so
  872.      GDB will treat the use of procedures `INCL' and `EXCL' as an
  873.      error.
  874.  
  875. 
  876. File: gdb.info,  Node: M2 Constants,  Next: M2 Defaults,  Prev: Built-In Func/Proc,  Up: Modula-2
  877.  
  878. Constants
  879. .........
  880.  
  881.    GDB allows you to express the constants of Modula-2 in the following
  882. ways:
  883.  
  884.    * Integer constants are simply a sequence of digits.  When used in
  885.      an expression, a constant is interpreted to be type-compatible
  886.      with the rest of the expression.  Hexadecimal integers are
  887.      specified by a trailing `H', and octal integers by a trailing `B'.
  888.  
  889.    * Floating point constants appear as a sequence of digits, followed
  890.      by a decimal point and another sequence of digits.  An optional
  891.      exponent can then be specified, in the form `E[+|-]NNN', where
  892.      `[+|-]NNN' is the desired exponent.  All of the digits of the
  893.      floating point constant must be valid decimal (base 10) digits.
  894.  
  895.    * Character constants consist of a single character enclosed by a
  896.      pair of like quotes, either single (`'') or double (`"').  They
  897.      may also be expressed by their ordinal value (their ASCII value,
  898.      usually) followed by a `C'.
  899.  
  900.    * String constants consist of a sequence of characters enclosed by a
  901.      pair of like quotes, either single (`'') or double (`"').  Escape
  902.      sequences in the style of C are also allowed.  *Note C and C++
  903.      Constants: C Constants, for a brief explanation of escape
  904.      sequences.
  905.  
  906.    * Enumerated constants consist of an enumerated identifier.
  907.  
  908.    * Boolean constants consist of the identifiers `TRUE' and `FALSE'.
  909.  
  910.    * Pointer constants consist of integral values only.
  911.  
  912.    * Set constants are not yet supported.
  913.  
  914. 
  915. File: gdb.info,  Node: M2 Defaults,  Next: Deviations,  Prev: M2 Constants,  Up: Modula-2
  916.  
  917. Modula-2 Defaults
  918. .................
  919.  
  920.    If type and range checking are set automatically by GDB, they both
  921. default to `on' whenever the working language changes to Modula-2. 
  922. This happens regardless of whether you, or GDB, selected the working
  923. language.
  924.  
  925.    If you allow GDB to set the language automatically, then entering
  926. code compiled from a file whose name ends with `.mod' will set the
  927. working language to Modula-2. *Note Having GDB set the language
  928. automatically: Automatically, for further details.
  929.  
  930. 
  931. File: gdb.info,  Node: Deviations,  Next: M2 Checks,  Prev: M2 Defaults,  Up: Modula-2
  932.  
  933. Deviations from Standard Modula-2
  934. .................................
  935.  
  936.    A few changes have been made to make Modula-2 programs easier to
  937. debug.  This is done primarily via loosening its type strictness:
  938.  
  939.    * Unlike in standard Modula-2, pointer constants can be formed by
  940.      integers.  This allows you to modify pointer variables during
  941.      debugging.  (In standard Modula-2, the actual address contained
  942.      in a pointer variable is hidden from you; it can only be modified
  943.      through direct assignment to another pointer variable or
  944.      expression that returned a pointer.)
  945.  
  946.    * C escape sequences can be used in strings and characters to
  947.      represent non-printable characters.  GDB will print out strings
  948.      with these escape sequences embedded.  Single non-printable
  949.      characters are printed using the `CHR(NNN)' format.
  950.  
  951.    * The assignment operator (`:=') returns the value of its right-hand
  952.      argument.
  953.  
  954.    * All built-in procedures both modify *and* return their argument.
  955.  
  956. 
  957. File: gdb.info,  Node: M2 Checks,  Next: M2 Scope,  Prev: Deviations,  Up: Modula-2
  958.  
  959. Modula-2 Type and Range Checks
  960. ..............................
  961.  
  962.      *Warning:* in this release, GDB does not yet perform type or
  963.      range checking.
  964.  
  965.    GDB considers two Modula-2 variables type equivalent if:
  966.  
  967.    * They are of types that have been declared equivalent via a `TYPE
  968.      T1 = T2' statement
  969.  
  970.    * They have been declared on the same line.  (Note:  This is true
  971.      of the GNU Modula-2 compiler, but it may not be true of other
  972.      compilers.)
  973.  
  974.    As long as type checking is enabled, any attempt to combine
  975. variables whose types are not equivalent is an error.
  976.  
  977.    Range checking is done on all mathematical operations, assignment,
  978. array index bounds, and all built-in functions and procedures.
  979.  
  980. 
  981. File: gdb.info,  Node: M2 Scope,  Next: GDB/M2,  Prev: M2 Checks,  Up: Modula-2
  982.  
  983. The scope operators `::' and `.'
  984. ................................
  985.  
  986.    There are a few subtle differences between the Modula-2 scope
  987. operator (`.') and the GDB scope operator (`::').  The two have
  988. similar syntax:
  989.  
  990.  
  991.      MODULE . ID
  992.      SCOPE :: ID
  993.  
  994. where SCOPE is the name of a module or a procedure, MODULE the name of
  995. a module, and ID is any declared identifier within your program,
  996. except another module.
  997.  
  998.    Using the `::' operator makes GDB search the scope specified by
  999. SCOPE for the identifier ID.  If it is not found in the specified
  1000. scope, then GDB will search all scopes enclosing the one specified by
  1001. SCOPE.
  1002.  
  1003.    Using the `.' operator makes GDB search the current scope for the
  1004. identifier specified by ID that was imported from the definition
  1005. module specified by MODULE.  With this operator, it is an error if the
  1006. identifier ID was not imported from definition module MODULE, or if ID
  1007. is not an identifier in MODULE.
  1008.  
  1009. 
  1010. File: gdb.info,  Node: GDB/M2,  Prev: M2 Scope,  Up: Modula-2
  1011.  
  1012. GDB and Modula-2
  1013. ................
  1014.  
  1015.    Some GDB commands have little use when debugging Modula-2 programs. 
  1016. Five subcommands of `set print' and `show print' apply specifically to
  1017. C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'. 
  1018. The first four apply to C++, and the last to C's `union' type, which
  1019. has no direct analogue in Modula-2.
  1020.  
  1021.    The `@' operator (*note Expressions: Expressions.), while available
  1022. while using any language, is not useful with Modula-2.  Its intent is
  1023. to aid the debugging of "dynamic arrays", which cannot be created in
  1024. Modula-2 as they can in C or C++.  However, because an address can be
  1025. specified by an integral constant, the construct `{TYPE}ADREXP' is
  1026. still useful.  (*note Expressions: Expressions.)
  1027.  
  1028.    In GDB scripts, the Modula-2 inequality operator `#' is interpreted
  1029. as the beginning of a comment.  Use `<>' instead.
  1030.  
  1031. 
  1032. File: gdb.info,  Node: Symbols,  Next: Altering,  Prev: Languages,  Up: Top
  1033.  
  1034. Examining the Symbol Table
  1035. **************************
  1036.  
  1037.    The commands described in this section allow you to inquire about
  1038. the symbols (names of variables, functions and types) defined in your
  1039. program.  This information is inherent in the text of your program and
  1040. does not change as your program executes.  GDB finds it in your
  1041. program's symbol table, in the file indicated when you started GDB
  1042. (*note Choosing Files: File Options.), or by one of the
  1043. file-management commands (*note Commands to Specify Files: Files.).
  1044.  
  1045. `info address SYMBOL'
  1046.      Describe where the data for SYMBOL is stored.  For a register
  1047.      variable, this says which register it is kept in.  For a
  1048.      non-register local variable, this prints the stack-frame offset
  1049.      at which the variable is always stored.
  1050.  
  1051.      Note the contrast with `print &SYMBOL', which does not work at
  1052.      all for a register variables, and for a stack local variable
  1053.      prints the exact address of the current instantiation of the
  1054.      variable.
  1055.  
  1056. `whatis EXP'
  1057.      Print the data type of expression EXP.  EXP is not actually
  1058.      evaluated, and any side-effecting operations (such as assignments
  1059.      or function calls) inside it do not take place.  *Note
  1060.      Expressions: Expressions.
  1061.  
  1062. `whatis'
  1063.      Print the data type of `$', the last value in the value history.
  1064.  
  1065. `ptype TYPENAME'
  1066.      Print a description of data type TYPENAME.  TYPENAME may be the
  1067.      name of a type, or for C code it may have the form `struct
  1068.      STRUCT-TAG', `union UNION-TAG' or `enum ENUM-TAG'.
  1069.  
  1070. `ptype EXP'
  1071. `ptype'
  1072.      Print a description of the type of expression EXP.  `ptype'
  1073.      differs from `whatis' by printing a detailed description, instead
  1074.      of just the name of the type.  For example, if your program
  1075.      declares a variable as
  1076.  
  1077.           struct complex {double real; double imag;} v;
  1078.  
  1079.      compare the output of the two commands:
  1080.  
  1081.           (gdb) whatis v
  1082.           type = struct complex
  1083.           (gdb) ptype v
  1084.           type = struct complex {
  1085.               double real;
  1086.               double imag;
  1087.           }
  1088.  
  1089.      As with `whatis', using `ptype' without an argument refers to the
  1090.      type of `$', the last value in the value history.
  1091.  
  1092. `info types REGEXP'
  1093. `info types'
  1094.      Print a brief description of all types whose name matches REGEXP
  1095.      (or all types in your program, if you supply no argument).  Each
  1096.      complete typename is matched as though it were a complete line;
  1097.      thus, `i type value' gives information on all types in your
  1098.      program whose name includes the string `value', but `i type
  1099.      ^value$' gives information only on types whose complete name is
  1100.      `value'.
  1101.  
  1102.      This command differs from `ptype' in two ways: first, like
  1103.      `whatis', it does not print a detailed description; second, it
  1104.      lists all source files where a type is defined.
  1105.  
  1106. `info source'
  1107.      Show the name of the current source file--that is, the source
  1108.      file for the function containing the current point of
  1109.      execution--and the language it was written in.
  1110.  
  1111. `info sources'
  1112.      Print the names of all source files in your program for which
  1113.      there is debugging information, organized into two lists: files
  1114.      whose symbols have already been read, and files whose symbols
  1115.      will be read when needed.
  1116.  
  1117. `info functions'
  1118.      Print the names and data types of all defined functions.
  1119.  
  1120. `info functions REGEXP'
  1121.      Print the names and data types of all defined functions whose
  1122.      names contain a match for regular expression REGEXP.  Thus, `info
  1123.      fun step' finds all functions whose names include `step'; `info
  1124.      fun ^step' finds those whose names start with `step'.
  1125.  
  1126. `info variables'
  1127.      Print the names and data types of all variables that are declared
  1128.      outside of functions (i.e., excluding local variables).
  1129.  
  1130. `info variables REGEXP'
  1131.      Print the names and data types of all variables (except for local
  1132.      variables) whose names contain a match for regular expression
  1133.      REGEXP.
  1134.  
  1135. `printsyms FILENAME'
  1136. `printpsyms FILENAME'
  1137. `printmsyms FILENAME'
  1138.      Write a dump of debugging symbol data into the file FILENAME. 
  1139.      These commands are used to debug the GDB symbol-reading code. 
  1140.      Only symbols with debugging data are included.  If you use
  1141.      `printsyms', GDB includes all the symbols for which it has
  1142.      already collected full details: that is, FILENAME reflects
  1143.      symbols for only those files whose symbols GDB has read.  You can
  1144.      use the command `info sources' to find out which files these are.
  1145.       If you use `printpsyms' instead, the dump shows information
  1146.      about symbols that GDB only knows partially--that is, symbols
  1147.      defined in files that GDB has skimmed, but not yet read
  1148.      completely.  Finally, `printmsyms' dumos just the minimal symbol
  1149.      information required for each object file from which GDB has read
  1150.      some symbols.  The description of `symbol-file' explains how GDB
  1151.      reads symbols; both `info source' and `symbol-file' are described
  1152.      in *Note Commands to Specify Files: Files.
  1153.  
  1154. 
  1155. File: gdb.info,  Node: Altering,  Next: GDB Files,  Prev: Symbols,  Up: Top
  1156.  
  1157. Altering Execution
  1158. ******************
  1159.  
  1160.    Once you think you have found an error in your program, you might
  1161. want to find out for certain whether correcting the apparent error
  1162. would lead to correct results in the rest of the run.  You can find
  1163. the answer by experiment, using the GDB features for altering
  1164. execution of the program.
  1165.  
  1166.    For example, you can store new values into variables or memory
  1167. locations, give your program a signal, restart it at a different
  1168. address, or even return prematurely from a function to its caller.
  1169.  
  1170. * Menu:
  1171.  
  1172. * Assignment::                  Assignment to Variables
  1173. * Jumping::                     Continuing at a Different Address
  1174. * Signaling::                   Giving your program a Signal
  1175. * Returning::                   Returning from a Function
  1176. * Calling::                     Calling your Program's Functions
  1177. * Patching::                    Patching your Program
  1178.  
  1179. 
  1180. File: gdb.info,  Node: Assignment,  Next: Jumping,  Prev: Altering,  Up: Altering
  1181.  
  1182. Assignment to Variables
  1183. =======================
  1184.  
  1185.    To alter the value of a variable, evaluate an assignment expression. 
  1186. *Note Expressions: Expressions.  For example,
  1187.  
  1188.      print x=4
  1189.  
  1190. stores the value 4 into the variable `x', and then prints the value of
  1191. the assignment expression (which is 4).  *Note Using GDB with
  1192. Different Languages: Languages, for more information on operators in
  1193. supported languages.
  1194.  
  1195.    If you are not interested in seeing the value of the assignment,
  1196. use the `set' command instead of the `print' command.  `set' is really
  1197. the same as `print' except that the expression's value is not printed
  1198. and is not put in the value history (*note Value History: Value
  1199. History.).  The expression is evaluated only for its effects.
  1200.  
  1201.    If the beginning of the argument string of the `set' command
  1202. appears identical to a `set' subcommand, use the `set variable'
  1203. command instead of just `set'.  This command is identical to `set'
  1204. except for its lack of subcommands.  For example, a program might well
  1205. have a variable `width'--which leads to an error if we try to set a
  1206. new value with just `set width=13', as we might if `set width' did not
  1207. happen to be a GDB command:
  1208.  
  1209.      (gdb) whatis width
  1210.      type = double
  1211.      (gdb) p width
  1212.      $4 = 13
  1213.      (gdb) set width=47
  1214.      Invalid syntax in expression.
  1215.  
  1216. The invalid expression, of course, is `=47'.  What we can do in order
  1217. to actually set our program's variable `width' is
  1218.  
  1219.      (gdb) set var width=47
  1220.  
  1221.    GDB allows more implicit conversions in assignments than C; you can
  1222. freely store an integer value into a pointer variable or vice versa,
  1223. and any structure can be converted to any other structure that is the
  1224. same length or shorter.
  1225.  
  1226.    To store values into arbitrary places in memory, use the `{...}'
  1227. construct to generate a value of specified type at a specified address
  1228. (*note Expressions: Expressions.).  For example, `{int}0x83040' refers
  1229. to memory location `0x83040' as an integer (which implies a certain
  1230. size and representation in memory), and
  1231.  
  1232.      set {int}0x83040 = 4
  1233.  
  1234. stores the value 4 into that memory location.
  1235.  
  1236. 
  1237. File: gdb.info,  Node: Jumping,  Next: Signaling,  Prev: Assignment,  Up: Altering
  1238.  
  1239. Continuing at a Different Address
  1240. =================================
  1241.  
  1242.    Ordinarily, when you continue your program, you do so at the place
  1243. where it stopped, with the `continue' command.  You can instead
  1244. continue at an address of your own choosing, with the following
  1245. commands:
  1246.  
  1247. `jump LINESPEC'
  1248.      Resume execution at line LINESPEC.  Execution will stop
  1249.      immediately if there is a breakpoint there.  *Note Printing
  1250.      Source Lines: List, for a description of the different forms of
  1251.      LINESPEC.
  1252.  
  1253.      The `jump' command does not change the current stack frame, or
  1254.      the stack pointer, or the contents of any memory location or any
  1255.      register other than the program counter.  If line LINESPEC is in
  1256.      a different function from the one currently executing, the
  1257.      results may be bizarre if the two functions expect different
  1258.      patterns of arguments or of local variables.  For this reason,
  1259.      the `jump' command requests confirmation if the specified line is
  1260.      not in the function currently executing.  However, even bizarre
  1261.      results are predictable if you are well acquainted with the
  1262.      machine-language code of your program.
  1263.  
  1264. `jump *ADDRESS'
  1265.      Resume execution at the instruction at address ADDRESS.
  1266.  
  1267.    You can get much the same effect as the `jump' command by storing a
  1268. new value into the register `$pc'.  The difference is that this does
  1269. not start your program running; it only changes the address where it
  1270. *will* run when it is continued.  For example,
  1271.  
  1272.      set $pc = 0x485
  1273.  
  1274. causes the next `continue' command or stepping command to execute at
  1275. address `0x485', rather than at the address where your program stopped. 
  1276. *Note Continuing and Stepping: Continuing and Stepping.
  1277.  
  1278.    The most common occasion to use the `jump' command is to back up,
  1279. perhaps with more breakpoints set, over a portion of a program that has
  1280. already executed, in order to examine its execution in more detail.
  1281.  
  1282. 
  1283. File: gdb.info,  Node: Signaling,  Next: Returning,  Prev: Jumping,  Up: Altering
  1284.  
  1285. Giving your program a Signal
  1286. ============================
  1287.  
  1288. `signal SIGNALNUM'
  1289.      Resume execution where your program stopped, but give it
  1290.      immediately the signal number SIGNALNUM.
  1291.  
  1292.      Alternatively, if SIGNALNUM is zero, continue execution without
  1293.      giving a signal.  This is useful when your program stopped on
  1294.      account of a signal and would ordinary see the signal when
  1295.      resumed with the `continue' command; `signal 0' causes it to
  1296.      resume without a signal.
  1297.  
  1298.      `signal' does not repeat when you press RET a second time after
  1299.      executing the command.
  1300.  
  1301. 
  1302. File: gdb.info,  Node: Returning,  Next: Calling,  Prev: Signaling,  Up: Altering
  1303.  
  1304. Returning from a Function
  1305. =========================
  1306.  
  1307. `return'
  1308. `return EXPRESSION'
  1309.      You can cancel execution of a function call with the `return'
  1310.      command.  If you give an EXPRESSION argument, its value is used
  1311.      as the function's return value.
  1312.  
  1313.    When you use `return', GDB discards the selected stack frame (and
  1314. all frames within it).  You can think of this as making the discarded
  1315. frame return prematurely.  If you wish to specify a value to be
  1316. returned, give that value as the argument to `return'.
  1317.  
  1318.    This pops the selected stack frame (*note Selecting a Frame:
  1319. Selection.), and any other frames inside of it, leaving its caller as
  1320. the innermost remaining frame.  That frame becomes selected.  The
  1321. specified value is stored in the registers used for returning values
  1322. of functions.
  1323.  
  1324.    The `return' command does not resume execution; it leaves the
  1325. program stopped in the state that would exist if the function had just
  1326. returned.  In contrast, the `finish' command (*note Continuing and
  1327. Stepping: Continuing and Stepping.) resumes execution until the
  1328. selected stack frame returns naturally.
  1329.  
  1330. 
  1331. File: gdb.info,  Node: Calling,  Next: Patching,  Prev: Returning,  Up: Altering
  1332.  
  1333. Calling your Program's Functions
  1334. ================================
  1335.  
  1336. `call EXPR'
  1337.      Evaluate the expression EXPR without displaying `void' returned
  1338.      values.
  1339.  
  1340.    You can use this variant of the `print' command if you want to
  1341. execute a function from your program, but without cluttering the output
  1342. with `void' returned values.  The result is printed and saved in the
  1343. value history, if it is not void.
  1344.  
  1345. 
  1346. File: gdb.info,  Node: Patching,  Prev: Calling,  Up: Altering
  1347.  
  1348. Patching your Program
  1349. =====================
  1350.  
  1351.    By default, GDB opens the file containing your program's executable
  1352. code (or the corefile) read-only.  This prevents accidental alterations
  1353. to machine code; but it also prevents you from intentionally patching
  1354. your program's binary.
  1355.  
  1356.    If you'd like to be able to patch the binary, you can specify that
  1357. explicitly with the `set write' command.  For example, you might want
  1358. to turn on internal debugging flags, or even to make emergency repairs.
  1359.  
  1360. `set write on'
  1361. `set write off'
  1362.      If you specify `set write on', GDB will open executable and core
  1363.      files for both reading and writing; if you specify `set write
  1364.      off' (the default), GDB will open them read-only.
  1365.  
  1366.      If you have already loaded a file, you must load it again (using
  1367.      the `exec-file' or `core-file' command) after changing `set
  1368.      write', for your new setting to take effect.
  1369.  
  1370. `show write'
  1371.      Display whether executable files and core files will be opened for
  1372.      writing as well as reading.
  1373.  
  1374. 
  1375. File: gdb.info,  Node: GDB Files,  Next: Targets,  Prev: Altering,  Up: Top
  1376.  
  1377. GDB's Files
  1378. ***********
  1379.  
  1380.    GDB needs to know the file name of the program to be debugged, both
  1381. in order to read its symbol table and in order to start your program. 
  1382. To debug a core dump of a previous run, GDB must be told the file name
  1383. of the core dump.
  1384.  
  1385. * Menu:
  1386.  
  1387. * Files::                       Commands to Specify Files
  1388. * Symbol Errors::               Errors Reading Symbol Files
  1389.  
  1390.